package com.mlh.springboot.controller;
import com.mlh.springboot.bean.Furn01;
import com.mlh.springboot.bean.Monster2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 缪林辉
 * @date 2024/2/27 22:48
 * @DESCRIPTION
 */
@Slf4j
@Controller
public class HelloController {
    @RequestMapping("/hello")
    @ResponseBody
    public String hello(){
        return "hello,SpringBoot";
    }

    @Autowired
    Furn01 furn;
    @RequestMapping("/furn")
    @ResponseBody
    public Furn01 furn(){
        //当请求/furn时，日志就会输出，
        //使用slf4j日志输出
        //普通方式输出
        log.info("furn="+furn);
        //占位符方式输出
        log.info("furn = {} ", furn);
        return furn;
    }

    @Autowired
    private Monster2 monster2;
    @RequestMapping("/monster2")
    @ResponseBody
    public Monster2 monster2(){
        return monster2;
    }
}
